<%@ page contentType="text/html;charset=UTF-8" language="java"
         isELIgnored="false"  %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html lang="zh">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>云R记</title>
    <link href="statics/css/note.css" rel="stylesheet">
    <link href="statics/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="statics/sweetalert/sweetalert2.min.css" rel="stylesheet">
    <link rel="shortcut icon" href="statics/images/blog.png" type="image/x-icon" />
    <link href="statics/css/server.css" rel="stylesheet">
    <script src="statics/js/jquery-1.11.3.js"></script>
    <script src="statics/bootstrap/js/bootstrap.js"></script>
    <script src="statics/sweetalert/sweetalert2.min.js"></script>
    <script src="statics/js/config.js"></script>
    <script src="statics/js/util.js"></script>

    <!-- 配置文件 -->
    <script type="text/javascript" src="statics/ueditor/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="statics/ueditor/ueditor.all.js"></script>

    <style type="text/css">
        body {
            padding-top: 60px;
            padding-bottom: 40px;
            background: url(statics/images/bg.gif) repeat;
        }
    </style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header" style="margin-left: 2%">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" style="font-size:25px" href="index">KarrySong云博客</a>
        </div>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav" style="margin-left: 3%">
                <li <c:if test="${menu_page=='index'}">class="active"</c:if> ><a href="index"><i class="glyphicon glyphicon-cloud"></i>&nbsp;主&nbsp;&nbsp;页</a></li>
                <li <c:if test="${menu_page=='note'}">class="active"</c:if> ><a href="blog?actionName=view"><i class="glyphicon glyphicon-pencil"></i>&nbsp;发表云记</a></li>
                <li <c:if test="${menu_page=='type'}">class="active"</c:if> ><a href="type?actionName=list"><i class="glyphicon glyphicon-list"></i>&nbsp;类别管理</a></li>
                <li <c:if test="${menu_page=='user'}">class="active"</c:if> ><a href="user?actionName=userCenter"><i class="glyphicon glyphicon-user"></i>&nbsp;个人中心</a>
                <li <c:if test="${menu_page=='report'}">class="active"</c:if> ><a href="report?actionName=info"><i class="glyphicon glyphicon-signal"></i>&nbsp;数据报表</a></li>
                <li <c:if test="${menu_page=='all'}">class="active"</c:if> ><a href="index?actionName=all"><i class="glyphicon glyphicon-globe"></i>&nbsp;博客大厅</a></li>
                <c:if test="${user.role > 1}">
                    <li <c:if test="${menu_page=='admin'}">class="active"</c:if> ><a href="admin?actionName=index" ><i class="glyphicon glyphicon-th-large"></i>&nbsp;后台管理</a></li>
                </c:if>
                <c:if test="${user.role == 1 || empty user || user.id == -1}">
                    <li <c:if test="${menu_page=='customer'}">class="active"</c:if> ><a href="index?actionName=goServer"><i class="glyphicon glyphicon-comment"></i>&nbsp;在线客服</a></li>
                </c:if>
            </ul>
            <form class="navbar-form navbar-right" role="search" action="index">
                <div class="form-group" >
                    <input type="hidden" name="actionName" value="searchTitle">
                    <input type="text" name="title" class="form-control" placeholder="搜索云记" value="${title}">
                </div>
                <button type="submit" class="btn btn-default" style="margin-right: 50px">查询</button>
            </form>
        </div>
    </div>
</nav>
<div class="container" style="width: 90%;">
    <div class="row-fluid" >
        <div class="col-md-3">
            <div class="data_list" style="border-radius: 15px">
                <div class="data_list_title" style="text-align: center">&nbsp;
                    <span style="color: #00a0e9" onclick="getServer()">客服</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class="glyphicon glyphicon-user" ><a href="user?actionName=userCenter" style="color: #0f0f0f;text-decoration: none">个人中心</a></span>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                        <c:if test="${user.id == -1 || empty user}">
                            <%--未登录--%>
                            <a href="login.jsp">登录</a>
                        </c:if>
                        <c:if test="${user.id != -1 &&  !empty user}">
                            <a href="user?actionName=logout">退出</a>
                        </c:if>
                    </div>

                <%--未登录用户固定头像与名称等--%>
                <c:if test="${user.id == -1 || empty user}">
                    <div class="userimg" >
                        <img class="img-circle" src="user?actionName=userHead&imageName=404.jpg" style="height: 200px;width: 200px;overflow: hidden" alt="${user.head}">
                    </div>
                    <div class="nick"><span style="width: 90%"><b>游客</b></span></div>
                    <div class="mood" style="overflow: hidden;height: auto;max-height: 100px"><span style="width: 90%;overflow-wrap: break-word">Hello,World!</span></div>

                </c:if>
                <c:if test="${user.id != -1 &&  !empty user}">
                    <div class="userimg" >

                        <img class="img-circle" src="user?actionName=userHead&imageName=${user.head}" style="height: 200px;width: 200px;overflow: hidden" alt="${user.head}">
                    </div>
                    <div class="nick"><span style="width: 90%"><b>${user.nick}</b></span></div>
                    <div class="mood" style="overflow: hidden;height: auto;max-height: 100px"><span style="width: 90%;overflow-wrap: break-word">${user.mood}</span></div>

                </c:if>
                </div>

            <%--消息通知--%>
            <div class="data_list" style="border-radius: 15px;height: auto;overflow-y: auto;max-height: 250px">
                <div class="data_list_title">
					<span class="glyphicon glyphicon-bell" style="height: 20px;">
					</span>&nbsp;消息通知&nbsp;
                    <c:if test="${fn:length(comments) > 0}">
                        <span class="badge" style="background-color: red;">${fn:length(comments)}</span></a></li>
                    </c:if>
                    <c:if test="${fn:length(comments) <= 0 || empty comments}">
                        （暂无消息）
                    </c:if>
                </div>
                <div>
                    <ul class="nav nav-pills nav-stacked">
                        <c:if test="${fn:length(comments) > 0}">
                            <c:forEach items="${comments}" var="item" varStatus="ss">
                                <li><a href="blog?actionName=detail&blogId=${item.blogId}">${item.userNick}
                                    <c:if test="${item.fatherCommentId == 0}">
                                        &nbsp;评论了你的博客
                                    </c:if>
                                    <c:if test="${item.fatherCommentId != 0}">
                                        &nbsp;回复了你的评论
                                    </c:if>
                                </li>

                            </c:forEach>
                        </c:if>
                    </ul>
                </div>

            </div>


            <div class="data_list" style="border-radius: 15px;height: auto;overflow-y: auto;max-height: 250px">
                <div class="data_list_title">
					<span class="glyphicon glyphicon-calendar">
					</span>&nbsp;云记日期
                </div>
                <div>
                    <ul class="nav nav-pills nav-stacked">
                        <c:forEach items="${dateInfo}" var="item">
                            <li><a href="index?actionName=searchDate&date=${item.groupName}">${item.groupName} <span class="badge">${item.groupCount}</span></a></li>
                        </c:forEach>
                    </ul>
                </div>

            </div>
            <div class="data_list" style="border-radius: 15px;height: auto;overflow-y: auto;max-height: 250px">
                <div class="data_list_title">
					<span class="glyphicon glyphicon-list-alt">
					</span>&nbsp;云记类别
                </div>

                <div>
                    <ul id="typeUl" class="nav nav-pills nav-stacked">
                        <c:forEach items="${typeInfo}" var="item">
                            <li id="li_${item.typeId}"><a href="index?actionName=searchType&typeId=${item.typeId}"><span id="sp_${item.typeId}">${item.groupName}</span> <span class="badge">${item.groupCount}</span></a></li>
                        </c:forEach>
                    </ul>
                </div>

            </div>
        </div>
    </div>

    <%--固定位置选项框--%>

<%--
    <div style="width: 3%;height: 5%;border: 2px #111111;background-color: #ffffff;border-radius: 2px;position: fixed;left: 1%;top: 48%"></div>
--%>


    <%-- 动态包含页面 --%>
    <%-- 云记列表 --%>
    <%--<jsp:include page="note/list.jsp"></jsp:include>--%>
    <%-- 个人中心 --%>
    <%--<jsp:include page="user/info.jsp"></jsp:include>--%>
    <%-- 类型列表 --%>
    <%--<jsp:include page="type/list.jsp"></jsp:include>--%>

    <%-- 通过后台设置动态显示的页面，通过包含加载进来 --%>
    <%-- 如果获取到后台设置的值，则显示；如果为获取到，则设置默认 --%>
    <c:if test="${empty changePage}">
        <jsp:include page="note/list.jsp"></jsp:include>
    </c:if>
    <c:if test="${!empty changePage}">
        <jsp:include page="${changePage}"></jsp:include>
    </c:if>




</div>



</body>

<script type="text/javascript">

    function getNotify(){
        $.ajax({
            type:"get",
            url:"index",
            data:{
                actionName:"getNotify"
            },
            success:function (result) {
                if (result.code == 1){
                    swal({
                        title:"系统通知",
                        text:result.result.text,
                        type: "info", // 图标  error	 success	info  warning
                        showCancelButton: false,  // 是否显示取消按钮
                        confirmButtonColor: "green", // 确认按钮的颜色
                        confirmButtonText: "确定", // 确认按钮的文本
                        allowOutsideClick: false, //不允许点击其他地方（点击其他地方不关闭）
                    })
                }else{

                }
            }
        });
    }

    //轮训请求，30秒一次
    setInterval(getNotify, 30000);



</script>

</html>

